const {
  getFileList
} = require("../../../api/api.js");
const pageMixin = require('../../../mixin/pageMixin.js');
const { _navigateTo } = require("../../../utils/util.js")
Page({
  mixins: [pageMixin],
  /**
   * 页面的初始数据
   */
  data: {
    listTitle: {
      0: '最新',
      1: '畅销',
      2: '推荐'
    },
    loadMethod: getFileList,
    allType: ['new', 'hot', 'recommend'],
    loadOptions: {
      currentType: 0,
      typeKey: 'type'
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    /**
     * 获取资料库列表
     */
    this.data.loadOptions.currentType = this.data.allType[0]
    this.loadData();
  },
  onReachBottom() {
    this.bottomLoading().catch((e) => {
      console.log(e)
    })
  },
  changetobankdetail(e){
    const id = e.currentTarget.dataset;
    _navigateTo(`./databank-detail/index?id=${id}`);
  }
})